<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Msg extends CI_Controller {

    public function __construct() {
        parent::__construct();
        
        $this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));
        $this->load->database();
        $this->load->library('user');
        session_start();

        //load default config settings
        $this->config->load('edgeworld', TRUE);
        $edgeWorld = $this->config->item('edgeworld');
        $this->user->token = $edgeWorld['bank_token'];
        $this->user->baseUrl = $edgeWorld['base_url'];

        if (isset($_SESSION['user'])) {
            $data = $_SESSION['user'];
            $this->user->id         = $data['id'];
            $this->user->name       = $data['name'];
            $this->user->allianceId = $data['allianceId'];
            $this->user->sampleUrl  = $data['sampleUrl'];
            $this->user->baseUrl    = $data['baseUrl'];
            $this->user->token      = $data['token'];
        }
        
    }

    public function index() {        
        $edgeWorld = $this->config->item('edgeworld');
        $token = $edgeWorld['bank_token'];
        $result       = $this->user->updateMessages($token);
        $data['messages']         = $this->user->getMessages();

        //var_dump($data);
        $this->load->view('msg', $data);
        
    }
    
    public function bank() {
        $edgeWorld = $this->config->item('edgeworld');
        $token = $edgeWorld['bank_token'];
        $this->user->updateBankHistory($token);
        
    }    
    

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */